Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflows #46

Merged
merged 45 commits into from
Nov 26, 2024
Merged

Fix workflows #46

merged 45 commits into from
Nov 26, 2024

Conversation

juancwu
Copy link
Contributor

@juancwu juancwu commented Nov 22, 2024

workflows seem to behave as expected now, and its good to merge.

Will need to force merge this even though backend test are not passing. Fixing the tests are outside of the scope of this PR.

Backend tests were failing before this PR and were not caught because the workflow check was not failing properly.

@juancwu juancwu added the enhancement New feature or request label Nov 22, 2024
@juancwu juancwu self-assigned this Nov 22, 2024
@juancwu juancwu linked an issue Nov 22, 2024 that may be closed by this pull request
@juancwu juancwu force-pushed the feat/45/combine-workflows branch from 16b263a to b81bc2a Compare November 25, 2024 02:32
Copy link

github-actions bot commented Nov 25, 2024

Test Results ❌

Status: failure
Coverage: 29.8%
OS: Linux

❌ Test Failures
--- FAIL: TestProjectCommentEndpoints (0.02s)
  
--- FAIL: TestProjectCommentEndpoints/create_comment (0.00s)
  

Error Details:
req_validator_test.go:104: {"test_field":true}
      
=== RUN   TestRequestBodyValidator/Invalid_request_body_-_validation_error
{"level":"error","error":"Key: 'testStruct.TestField' Error:Field validation for 'TestField' failed on the 'required' tag","time":"2024-11-26T04:17:38Z","message":"Validation error"}
  req_validator_test.go:104: {"message":"Internal Server Error"}
      
=== RUN   TestRequestBodyValidator/Empty_request_body
{"level":"error","error":"Key: 'testStruct.TestField' Error:Field validation for 'TestField' failed on the 'required' tag","time":"2024-11-26T04:17:38Z","message":"Validation error"}
  req_validator_test.go:104: {"message":"Internal Server Error"}
      
=== RUN   TestRequestBodyValidator/Invalid_JSON_format
  req_validator_test.go:104: {"message":"Invalid request body: code=400, message=Syntax error: offset=21, error=invalid character 'i' looking for beginning of value, internal=invalid character 'i' looking for beginning of value"}
      
=== RUN   TestRequestBodyValidator/Wrong_type_in_JSON
  req_validator_test.go:104: {"message":"Invalid request body: code=400, message=Unmarshal type error: expected=bool, got=string, field=test_field, offset=29, internal=json: cannot unmarshal string into Go struct field testStruct.test_field of type bool"}
      
--- PASS: TestRequestBodyValidator (0.00s)
  --- PASS: TestRequestBodyValidator/Valid_request_body (0.00s)
  --- PASS: TestRequestBodyValidator/Invalid_request_body_-_validation_error (0.00s)
  --- PASS: TestRequestBodyValidator/Empty_request_body (0.00s)
  --- PASS: TestRequestBodyValidator/Invalid_JSON_format (0.00s)
  --- PASS: TestRequestBodyValidator/Wrong_type_in_JSON (0.00s)
PASS
coverage: 29.8% of statements
ok  	github.com/KonferCA/NoKap/internal/middleware	0.008s	coverage: 29.8% of statements
=== RUN   TestAuth
=== RUN   TestAuth/signup
{"level":"info","method":"POST","path":"/api/v1/auth/signup","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
{"level":"info","X-Request-Id":"","Content-Type":"application/json","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
=== RUN   TestAuth/duplicate_email
{"level":"info","method":"POST","path":"/api/v1/auth/signup","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
{"level":"error","error":"code=409, message=email already registered","X-Request-Id":"","Content-Type":"","Content-Length":"","time":"2024-11-26T04:17:39Z"}
{"level":"info","X-Request-Id":"","Content-Type":"","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
{"level":"warn","error":"code=409, message=email already registered","request_id":"","method":"POST","path":"/api/v1/auth/signup","status":409,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
=== RUN   TestAuth/signin
{"level":"info","method":"POST","path":"/api/v1/auth/signin","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
{"level":"info","X-Request-Id":"","Content-Type":"application/json","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
=== RUN   TestAuth/invalid_credentials
{"level":"info","method":"POST","path":"/api/v1/auth/signin","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
{"level":"error","error":"code=401, message=invalid credentials","X-Request-Id":"","Content-Type":"","Content-Length":"","time":"2024-11-26T04:17:39Z"}
{"level":"info","X-Request-Id":"","Content-Type":"","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
{"level":"warn","error":"code=401, message=invalid credentials","request_id":"","method":"POST","path":"/api/v1/auth/signin","status":401,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
--- PASS: TestAuth (0.27s)
  --- PASS: TestAuth/signup (0.07s)
  --- PASS: TestAuth/duplicate_email (0.00s)
  --- PASS: TestAuth/signin (0.07s)
  --- PASS: TestAuth/invalid_credentials (0.07s)
=== RUN   TestGlobalErrorHandler
=== RUN   TestGlobalErrorHandler/http_error
{"level":"warn","error":"code=400, message=bad request","request_id":"","method":"GET","path":"/","status":400,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
=== RUN   TestGlobalErrorHandler/generic_error
{"level":"error","error":"code=500, message=something went wrong","request_id":"","method":"GET","path":"/","status":500,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
=== RUN   TestGlobalErrorHandler/validation_error
{"level":"warn","error":"Key: 'TestStruct.Email' Error:Field validation for 'Email' failed on the 'email' tag\nKey: 'TestStruct.Age' Error:Field validation for 'Age' failed on the 'gt' tag","request_id":"","method":"GET","path":"/","status":400,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
=== RUN   TestGlobalErrorHandler/with_request_id
{"level":"warn","error":"code=400, message=bad request","request_id":"test-123","method":"GET","path":"/","status":400,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
--- PASS: TestGlobalErrorHandler (0.00s)
  --- PASS: TestGlobalErrorHandler/http_error (0.00s)
  --- PASS: TestGlobalErrorHandler/generic_error (0.00s)
  --- PASS: TestGlobalErrorHandler/validation_error (0.00s)
  --- PASS: TestGlobalErrorHandler/with_request_id (0.00s)
=== RUN   TestGetSystemInfo
--- PASS: TestGetSystemInfo (0.00s)
=== RUN   TestHealthCheckHandler
=== RUN   TestHealthCheckHandler/healthy_system
=== RUN   TestHealthCheckHandler/unhealthy_system
--- PASS: TestHealthCheckHandler (0.01s)
  --- PASS: TestHealthCheckHandler/healthy_system (0.00s)
  --- PASS: TestHealthCheckHandler/unhealthy_system (0.00s)
=== RUN   TestProjectCommentEndpoints
{"level":"info","method":"POST","path":"/api/v1/companies","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
{"level":"info","X-Request-Id":"","Content-Type":"application/json","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
  project_comment_test.go:75: Company creation response: {
        "ID": "fa04a9d2-fdd3-48ae-b1a9-b77bcc4293f6",
        "OwnerUserID": "4b1672c8-7048-4785-ac25-ef05755cfd7f",
        "Name": "Test Company",
        "Description": "Test Company Description",
        "IsVerified": false,
        "CreatedAt": "2024-11-26T04:17:39.302869Z",
        "UpdatedAt": "2024-11-26T04:17:39.302869Z",
        "DeletedAt": null
      }
{"level":"info","method":"POST","path":"/api/v1/projects","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
Creating project with params: company_id=fa04a9d2-fdd3-48ae-b1a9-b77bcc4293f6, title=Test Project, status=draft
Created project: {ID:278de23d-c3b2-46b2-8931-f523aea90380 CompanyID:fa04a9d2-fdd3-48ae-b1a9-b77bcc4293f6 Title:Test Project Description:0xc0004d4370 Status:draft CreatedAt:{Time:2024-11-26 04:17:39.304093 +0000 UTC InfinityModifier:finite Valid:true} UpdatedAt:{Time:2024-11-26 04:17:39.304093 +0000 UTC InfinityModifier:finite Valid:true}}
{"level":"info","X-Request-Id":"","Content-Type":"application/json","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
  project_comment_test.go:103: Project creation response: {
        "ID": "278de23d-c3b2-46b2-8931-f523aea90380",
        "CompanyID": "fa04a9d2-fdd3-48ae-b1a9-b77bcc4293f6",
        "Title": "Test Project",
        "Description": "Test Description",
        "Status": "draft",
        "CreatedAt": "2024-11-26T04:17:39.304093Z",
        "UpdatedAt": "2024-11-26T04:17:39.304093Z"
      }
=== RUN   TestProjectCommentEndpoints/create_comment
{"level":"info","method":"POST","path":"/api/v1/projects/278de23d-c3b2-46b2-8931-f523aea90380/comments","X-Request-Id":"","X-Real-Ip":"","Content-Type":"application/json","Content-Length":"","remote_addr":"192.0.2.1:1234","user_agent":"","real_ip":"192.0.2.1","time":"2024-11-26T04:17:39Z","message":"New request!"}
{"level":"error","error":"code=400, message=Missing project ID :(","X-Request-Id":"","Content-Type":"","Content-Length":"","time":"2024-11-26T04:17:39Z"}
{"level":"info","X-Request-Id":"","Content-Type":"","Content-Length":"","time":"2024-11-26T04:17:39Z","message":"Requested processed."}
{"level":"warn","error":"code=400, message=Missing project ID :(","request_id":"","method":"POST","path":"/api/v1/projects/278de23d-c3b2-46b2-8931-f523aea90380/comments","status":400,"user_agent":"","time":"2024-11-26T04:17:39Z","message":"request error"}
  project_comment_test.go:129: Create comment response: {
        "status": 400,
        "message": "Missing project ID :("
      }
  project_comment_test.go:130: 
      	Error Trace:	/home/runner/work/SPUR/SPUR/backend/internal/server/project_comment_test.go:130
      	Error:      	Not equal: 
      	            	expected: 201
      	            	actual  : 400
      	Test:       	TestProjectCommentEndpoints/create_comment
project_comment_test.go:135: 
      	Error Trace:	/home/runner/work/SPUR/SPUR/backend/internal/server/project_comment_test.go:135
      	Error:      	Not equal: 
      	            	expected: string("278de23d-c3b2-46b2-8931-f523aea90380")
      	            	actual  : <nil>(<nil>)
      	Test:       	TestProjectCommentEndpoints/create_comment
project_comment_test.go:136: 
      	Error Trace:	/home/runner/work/SPUR/SPUR/backend/internal/server/project_comment_test.go:136
      	Error:      	Not equal: 
      	            	expected: string("This is a test comment")
      	            	actual  : <nil>(<nil>)
      	Test:       	TestProjectCommentEndpoints/create_comment
project_comment_test.go:145: List comments response: {
        "status": 400,
        "message": "Missing project ID :("
      }
  project_comment_test.go:146: 
      	Error Trace:	/home/runner/work/SPUR/SPUR/backend/internal/server/project_comment_test.go:146
      	Error:      	Not equal: 
      	            	expected: 200
      	            	actual  : 400
      	Test:       	TestProjectCommentEndpoints/list_comments
project_comment_test.go:150: 
      	Error Trace:	/home/runner/work/SPUR/SPUR/backend/internal/server/project_comment_test.go:150
      	Error:      	Received unexpected error:
      	            	json: cannot unmarshal object into Go value of type []map[string]interface {}
      	Test:       	TestProjectCommentEndpoints/list_comments
project_comment_test.go:151: 
      	Error Trace:	/home/runner/work/SPUR/SPUR/backend/internal/server/project_comment_test.go:151
      	Error:      	"[]" should have 1 item(s), but has 0
      	Test:       	TestProjectCommentEndpoints/list_comments
Test Details
  • Triggered by: @juancwu
  • Commit: 09302eb
  • Branch: refs/pull/46/merge
  • Workflow: .github/workflows/test-backend.yml

@juancwu juancwu changed the title Feat/45/combine workflows Fix workflows Nov 25, 2024
@juancwu juancwu added the bug Something isn't working label Nov 25, 2024
Copy link
Member

@AmirAgassi AmirAgassi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@juancwu juancwu merged commit 942438d into main Nov 26, 2024
4 of 5 checks passed
@juancwu juancwu deleted the feat/45/combine-workflows branch November 26, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Combine workflows for test and preview deployment
3 participants